<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class CategoryStatistics
 * @package App\Models
 * @version November 15, 2017, 6:44 am CST
 *
 * @property date date
 * @property integer type
 * @property integer goods_count
 * @property decimal goods_amount
 * @property integer goods_return_count
 * @property decimal goods_return_amount
 * @property decimal goods_return_rate
 * @property string json
 */
class CategoryStatistics extends Model
{
    use SoftDeletes;

    public $table = 'category_statistics';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'category_id',
        'date',
        'type',
        'goods_count',
        'goods_amount',
        'goods_return_count',
        'goods_return_amount',
        'goods_return_rate',
        'json'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
//        'date' => 'date',
        'type' => 'integer',
        'goods_count' => 'integer',
        'goods_return_count' => 'integer',
        'json' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    public function category()
    {
        return $this->belongsTo('App\Models\Category');
    }
}
